import Vue from 'vue';
import Antd from 'ant-design-vue';
import router from './config/router-config';
import Storage from 'vue-ls';
import vueLsConfig from './config/vue-ls-config';
import store from './store';
import {VueAxios} from './utils/request';
import App from './App.vue';
import 'ant-design-vue/dist/antd.css';
import config from './config/app-default-config';
import preview from 'vue-photo-preview'; // 图片预览
import 'vue-photo-preview/dist/skin.css';// 图片预览css

import {SIDEBAR_TYPE, DEFAULT_THEME,DEFAULT_LAYOUT_MODE,
  DEFAULT_FIXED_HEADER, DEFAULT_FIXED_SIDEMENU,DEFAULT_CONTENT_WIDTH_TYPE,
  DEFAULT_FIXED_HEADER_HIDDEN, DEFAULT_COLOR_WEAK, DEFAULT_COLOR, DEFAULT_MULTI_PAGE,
  ACCESS_TOKEN
} from './store/mutation-types';
import hasPermission from './utils/hasPermission';
import './assets/less/common.less'
Vue.config.productionTip = false
// 使用antdjs
Vue.use(Antd);
Vue.use(VueAxios);
Vue.use(Storage, vueLsConfig);// 使用本地存储
Vue.use(preview);
Vue.use(hasPermission);
new Vue({
  router,
  store,
  mounted () {
    store.commit('SET_SYSTEM_NAME', config.systemName);
    store.commit('SET_SYSTEM_SIMPLE_NAME', config.systemSimpleName);
    store.commit('SET_SYSTEM_LOGO', config.systemLogo);
    store.commit('SET_SYSTEM_LOGIN_LOGO', config.systemLoginLogo);
    store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true));
    store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme));
    store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout));
    store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, config.fixedHeader));
    store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, config.fixSiderbar));
    store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, config.contentWidth));
    store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, config.autoHideHeader));
    store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, config.colorWeak));
    store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor));
    store.commit('SET_MULTI_PAGE',Vue.ls.get(DEFAULT_MULTI_PAGE,true));
  },
  render: h => h(App),

}).$mount('#app')
